<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <script src="./src/vue.js"></script>
    <title>Document</title>
    <style>
      * {
        margin: 0;
        padding: 0;
      }
      .nav {
        position: fixed;
        left: 0;
        top: 0;
        width: 100vw;
      }
      .nav > h1 {
        height: 50px;
        text-align: center;
        line-height: 50px;
        font-size: 20px;
        background-color: lightblue;
      }
      .nav > h3 {
        height: 30px;
        text-align: center;
        line-height: 30px;
        font-size: 14px;
        background-color: red;
      }
      .scroll {
        margin-top: 80px;
        overflow-y: scroll;
        height: 100vh;
      }
      .scroll p {
        height: 100px;
        line-height: 100px;
        border-bottom: 1px solid red;
      }
      .d2 {
        overflow: hidden;
        height: 100vh;
      }
    </style>
  </head>
  <body>
    <div id="app">
      <div class="d1">
        <div class="d2">
          <div class="nav">
            <h1>导航</h1>
            <h3>副标题</h3>
          </div>
          <div class="scroll" @scroll="scrollEvent">
            <p v-for="(user,i) in users" :key="i">用户id: {{user.id}}</p>
          </div>
        </div>
      </div>
    </div>
    <script>
      const vm = new Vue({
        el: "#app",
        data: {
          users: [
            { id: 1 },
            { id: 2 },
            { id: 3 },
            { id: 4 },
            { id: 5 },
            { id: 6 },
            { id: 7 },
            { id: 8 },
            { id: 9 },
            { id: 10 },
          ],
        },
        methods: {
          scrollEvent(e) {
            console.log("----");
          },
        },
      });
    </script>
  </body>
</html>
